From 2963864583aed2cacff08ae5514a120b81b4d4fa Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Fri, 25 Mar 2005 16:06:24 +0000 Subject: [PATCH] Committing my thoughts on .an1 to posterity in code form. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@1103 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/intdoc/SA2003_an1_dump.pl | 135 +++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 gpsbabel/intdoc/SA2003_an1_dump.pl diff --git a/gpsbabel/intdoc/SA2003_an1_dump.pl b/gpsbabel/intdoc/SA2003_an1_dump.pl new file mode 100644 index 000000000..acf497da1 --- /dev/null +++ b/gpsbabel/intdoc/SA2003_an1_dump.pl @@ -0,0 +1,135 @@ +#!/usr/bin/perl + +=pod + + This script reads a DeLorme Street Atlas 2003 .an1 (drawing) file + and prints various pertinent data from it. Anything with a variable + name starting with "unk" or "magic" or "zero" is probably something + we don't yet understand. Suggestions as to what some of these fields + mean are welcome. The author disclaims any liability arising from + the use of any information contained within this script. + + Copyright (C) 2005 Ronald L. Parker (babelan1perl@parkrrrr.com) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA + +=cut + +# Convert a longword to a latitude or longitude +sub decode { + my $foo = shift; + + my $deg = (0x80000000-$foo)/(0x800000); + sprintf( "%d %06.3f", $deg, 60*($deg-int($deg))); +} + + +# read a data structure from the input file. +sub shiftunpack { + + my $pattern = shift; + my @result = unpack( $pattern, $file ); + my $str = pack( $pattern, @result ); + $file = substr( $file, length( $str )); + @result; +} + +sub skip_bytes { + my $count = shift; + $file = substr( $file, $count ); +} + +# read file +undef $/; +$file = <>; + +# read file header +($magic, $unk1 ) = shiftunpack( 'ss' ); + +print <